//
//  ShowSetCell.m
//  IBaby
//
//  Created by ZengYuan on 14/11/26.
//  Copyright (c) 2014年 com.zhongwei. All rights reserved.
//

#import "ShowSetCell.h"
#import "Config.h"


@implementation ShowSetCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    content_width=kScreenWidth*(0.6);
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    self.contentLabel = [[UILabel alloc]init];
    [self addSubview:self.contentLabel];
    self.contentLabel.backgroundColor=[UIColor clearColor];
    self.contentLabel.textColor=HexRGB(0xb6b6b6);
    self.contentLabel.textAlignment=NSTextAlignmentRight;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentLabel.font = SETTINGCELL_FONT;
    
    
    self.showImagView = [[UIImageView alloc]init];
    [self addSubview:self.showImagView];
    self.showImagView.contentMode = UIViewContentModeScaleAspectFit;
    self.showImagView.clipsToBounds = YES;
    

    
    
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    [self.showImagView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@(30));
        make.height.equalTo(@(30));
        make.right.equalTo(self.mas_right).offset(-50);
        make.centerY.equalTo(self);
    }];
    
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@(content_width));
        make.height.equalTo(@(30));
        make.right.equalTo(self.mas_right).offset(-40);
        make.centerY.equalTo(self);
    }];
}

// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.

/*
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 
 
 [super drawRect:rect];
 //    self.accessoryType = UITableViewCellAccessoryNone;
 //    self.selectionStyle = UITableViewCellSelectionStyleNone;
 
 
 //    if(OSVersionIsAtLeastiOS6){
 //        rec = self.textLabel.frame;
 //        self.textLabel.backgroundColor=[UIColor blueColor];
 //        rec.size.width=300;
 //        self.textLabel.frame=rec;
 //    }
 
 //如果有图像，textlabel会自动向右移动，contentlabel就让他变短
 if(self.imageView.image){
 content_width=100;
 }else{
 content_width=kScreenWidth*(0.6);
 }
 
 
 CGRect rec = self.contentLabel.frame;
 if(!self.showIndicator){
 rec.origin.x = kScreenWidth-content_width-20;
 }else{
 rec.origin.x = kScreenWidth-content_width-40;
 }
 self.contentLabel.frame=rec;
 //    self.contentLabel.backgroundColor=[UIColor blueColor];
 }
 */


@end
